<template>
  <views class="article_list">
    <viewTitle :title="'日志列表'"></viewTitle>
    <div class="table_list">
      <el-table :data="tableList" style="width: 100%" border :header-cell-style="getRowClass">
        <el-table-column type="index" label="序号" width="100"></el-table-column>
        <el-table-column prop="user" label="用户" width="180"></el-table-column>
        <el-table-column prop="actname" label="操作名称" width="200"></el-table-column>
        <el-table-column prop="actpath" label="访问路径" width="300"></el-table-column>
        <el-table-column :formatter="(row)=>{return this.$moment(row.time * 1000).format('YYYY-MM-DD HH:mm:ss')}" label="访问时间"></el-table-column>\
      </el-table>
      <div class="flex flexR paging">
        <el-pagination
          style="background:#fff; padding:10px 0"
          background
          layout="prev, pager, next,sizes,total, jumper"
          @size-change="(page_size) => {this.pagination.page_size = page_size;this.getData()}"
          @current-change="(page_size) => {this.pagination.page_start = page_size;this.getData()}"
          :page-sizes="[10, 20, 30, 50]"
          :page-size="pagination.page_size"
          :total="pagination.total_count"
          :current-page="pagination.current_page"
          :page-count="pagination.page_count"
        ></el-pagination>
      </div>
    </div>
  </views>
</template>


<script>
export default {
  data() {
    return {
      keywords: "", // 编入时间
      create_time:[],
      publish_unit: "", // 组织
      // 组织列表
      tableList: [],
      pagination: {
        page_start: 0, //搜索开始页码
        current_page: 0, //当前页码
        page_count: 0, //总页数
        page_size: 10, //每页数量
        total_count: 0 //总数量
      }
    };
  },
  methods: {
    //    修改第一行样式
    getRowClass({ row, column, rowIndex, columnIndex }) {
      if (rowIndex === 0) {
        return "background: #FAFAFA ";
      } else {
        return "";
      }
    },
    // 获取数据
    getData() {
	    this.$raxios.post(
		    this.$mapapi.admin_oprateloglist,
		    { data:this.post_data}
	    ).then(res=>{
		    let { code, msg, data } = res;
		    if (code != 200 && code != 501) {
			    this.tableList = [];
			    this.pagination = [];
			    this.$message.error(res.msg);
			    return;
		    }
		    this.tableList = data.list;
		    this.pagination = data.pagination;
      })
    }
  },
  computed:{
      post_data(){
          let data = {};
          data.pagination = this.pagination;
          return data;
      }
  },
  mounted() {
      this.getData();
  },
  created() {}
};
</script>





<style lang="less" :scope="true"  src="@/style/infomation_manager/article_list.less">
</style>
